package com.cpi.cornpp.instructionstypes.services;

import java.util.List;

import com.cpi.cornpp.common.exception.CornPPException;
import com.cpi.cornpp.instructionstypes.converter.InstructionsTypesConverter;
import com.cpi.cornpp.instructionstypes.dao.InstructionsTypesDAO;
import com.cpi.cornpp.instructionstypes.exception.InstructionsTypesException;

/**
 * Instructions Types Service
 * @author Edgar Joao
 *
 */
public class InstructionsTypesService {
	/**
	 * Lista de Instructions Types
	 * @return
	 * @throws InstructionsTypesException
	 */
	public List getInstructionsTypesList() throws InstructionsTypesException {
		InstructionsTypesDAO dao = null;
		InstructionsTypesConverter converter = null;		
		List list = null;				
		try{
			dao = new InstructionsTypesDAO();
			converter = new InstructionsTypesConverter();
			list =  converter.convertDTOsToViews(dao.getInstructionsTypesList());			
		} catch (InstructionsTypesException instructionsTypesException) {
			throw instructionsTypesException;
		} catch (Exception e){
			InstructionsTypesException instructionsTypesException = null;
			e.printStackTrace(System.out);
			instructionsTypesException = new InstructionsTypesException(e , CornPPException.LAYER_SERVICE,CornPPException.ACTION_LISTS);
			throw instructionsTypesException;
		}							
		return list;
	}
}
